<template>
	<view class="content">
		<swiper class="swiper" :autoplay="autoplay" @change="swiperChange" :duration="duration" :current='current'>
			<swiper-item v-for="(item,index) in list">
				<view class="swiper-item" :style="{
					'background-image': $img(item.img)
				}">
				</view>
			</swiper-item>
		</swiper>
		<view class="lj" @click.stop="login">立即體驗</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				wx: {},
				list: [{
					img: 'https://junhe-project.oss-cn-beijing.aliyuncs.com/img/2022-03-05/164647043663870.png',
					text1: '优质',
					text2: '优质店铺任你筛选',
				}, ],
				current: 0,
				windowHeight: '',
				background: ['color1', 'color2', 'color3'],
				autoplay: false,
				duration: 500,
				jumpover: '跳过',
				experience: '立即体验'
			}
		},
		onLoad() {
			uni.getSystemInfo({
				success(res) {
					this.windowHeight = res.windowHeight + "px";
				}
			})
			this.wx = wx.getMenuButtonBoundingClientRect()
		},
		methods: {
			getuserinfo() {
				wx.getUserInfo({
					success: function(res) {
						console.log(res)
					},
				})
			},
			getPhoneNumber(e) {
				console.log(e)
			},
			login() {
				uni.login({
					provider: 'weixin',
					success: async (res) => {
						const code = res.code
						this.api('user/WeChat', {
							code: code
						}).then(v => {
							console.log(v)
						})
					}
				})
				return
				// uni.getUserProfile({
				// 	desc: '獲取您的昵稱、頭像、地區及性別',
				// 	success: infoRes => {
				// 		console.log(JSON.parse(infoRes.rawData))
				// 	}
				// });

				//微信授权
				uni.setStorage({
					key: 'launchFlag',
					data: true,
				});
				uni.switchTab({
					url: '/pages/index/index'
				});

			}
		}
	}
</script>
<style lang="scss">
	.lj {
		z-index: 9999;
		position: absolute;
		bottom: 100rpx;
		display: inline-block;
		width: 400rpx;
		height: 80rpx;
		background: #00795E;
		border-radius: 40rpx;
		left: 50%;
		transform: translate(-50%);
		text-align: center;
		font-size: 32rpx;
		font-family: Source Han Serif CN;
		font-weight: 600;
		color: #FFFFFF;
		line-height: 80rpx;
	}

	.swiper-item-text {
		position: relative;
		top: 170rpx;

		text {
			display: block;
		}

		text:nth-of-type(1) {
			font-size: 52rpx;
			font-family: OPPOSans;
			font-weight: 500;
			color: #FFFFFF;
		}

		text:nth-of-type(2) {
			font-size: 30rpx;
			line-height: 100rpx;
			font-family: OPPOSans;
			font-weight: 500;
			color: #FFFFFF;
		}
	}

	.dian {
		position: absolute;
		width: 150rpx;
		bottom: 150rpx;
		margin-left: -75rpx;
		display: flex;
		justify-content: space-between;
		left: 50%;

		text {
			display: inline-block;
			width: 20rpx;
			height: 20rpx;

			border-radius: 50%;
		}
	}

	page,
	.content {
		width: 100%;
		height: 100%;
		background-size: 100% auto;
		padding: 0;
	}

	.swiper {
		width: 100%;
		height: 100%;
		background: #FFFFFF;
	}

	.swiper-item {
		justify-content: center;
		align-items: center;
		width: 100%;
		height: 100%;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		text-align: center;
		position: relative;
		display: flex;
		align-items: center;
		flex-direction: column-reverse
	}

	.swiper-item-img {
		width: 241rpx;
		height: 112rpx;
		position: absolute;
		bottom: 270rpx;
	}

	.swiper-item-img image {
		width: 100%;
		height: 100%;
	}

	.uniapp-img {
		height: 20%;
		background: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
		overflow: hidden;
	}

	.uniapp-img image {
		width: 40%;
	}

	.jump-overwx {
		right: 35upx;
		top: 140upx;
	}

	.jump-over,
	.jump-overwx,
	.experience {
		position: absolute;
		height: 60upx;
		line-height: 60upx;
		padding: 0 40upx;
		border-radius: 30upx;
		font-size: 32upx;
		color: #FFFFFF;
		background: rgba(255, 255, 255, 0.2);
		z-index: 999;
	}

	.jump-over {
		right: 35upx;
		top: 70upx;
	}

	.experience {
		right: 50%;
		margin-right: -105upx;
		bottom: 0;
	}
</style>
